//
//  ColorTools.h
//  Stock_Pro
//
//  Created by imuse on 10-11-20.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

//判断是否ios7及更高系统版本
//#define IOS7_OR_LATER ([[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending)
//#define IOS7_OR_LATER [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0

#define BLACKCOLOR  [UIColor colorWithRed:107/255.f green:107/255.f blue:107/255.f alpha:1.0]
#define BLUECOLOR   [UIColor colorWithRed:229/255.f green:242/255.f blue:250/255.f alpha:1.0]
#define REDCOLOR		_rgb2uic(0xe44d42,1.0)
#define GREENCOLOR  _rgb2uic(0x30ae0e,1.0)
#define GREENCOLOR2 _rgb2uic(0x6be300,1.0)
#define GREENCOLOR3 _rgb2uic(0x006b12,1.0)
#define WHITECOLOR1 _rgb2uic(0x3b3b3b,1.0)
#define LIGHTBLACK  _rgb2uic(0x6b6b6b,1.0)

#define MYCustomColor(a,b,c,d) [UIColor colorWithRed:(a)/255.f green:(b)/255.f blue:(c)/255.f alpha:(d)]

#define getColorRGB(a,b) a>b?[UIColor redColor]:a==b?[UIColor whiteColor]:[UIColor greenColor]
#define getColorRGW24(a,b) a>b?0xFF0000:a==b?0x000000:0x00AA00
#define getColorRGWE(a, b) a>b?REDCOLOR:a==b?LIGHTBLACK:GREENCOLOR
#define getColorRGW(a,b) a==0?LIGHTBLACK:getColorRGWE(a,b)

#define getColorRGW2(a,b) a>b?REDCOLOR:a==b?[UIColor whiteColor]:GREENCOLOR2
#define getColorRGW3(a,b) a>b?REDCOLOR:a==b?WHITECOLOR1:GREENCOLOR3
#define getColorRGWHOMEOWN(a,b) a==0?[UIColor grayColor]:getColorRGBHOMEOWN(a,b)
#define getColorRGBHOMEOWN(a,b) a>b?REDCOLOR:a==b?BLACKCOLOR:GREENCOLOR


#define getColorBS(a) a=='B'?0xFF0000:a=='S'?0x00AA00:0xFFFFFF


#define _rgb2uic(i,a) [UIColor colorWithRed:(i>>16&0xFF)/255.0 green:(i>>8&0xFF)/255.0 blue:(i&0xFF)/255.0 alpha:a]
#define getColorRGB_DG(a,b) a>b?REDCOLOR:a==b?[UIColor whiteColor]:GREENCOLOR

#pragma mark ==========
#pragma mark 新增

#define getRGColor(a,b,r,g) a>=b?r:g
#define getColor(a,b,r,g,e) a==0?e:a>=b?r:g//getRGColor(a,b,r,g)

int stringToHex(NSString* aString);

#pragma mark ==========
@interface ColorTools : NSObject {

}

@end
